package cn.tedu.csmall.product.controller;

import cn.tedu.csmall.product.pojo.dto.SkuSpecificationAndNewDTO;
import cn.tedu.csmall.product.service.ISkuSpecificationService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
@Api(tags = "12.SKU数据管理模块")
@RestController
@Slf4j
@RequestMapping("/skuSpectfication")
public class SkuSpectficationController {
    @Autowired
    ISkuSpecificationService service;
    public SkuSpectficationController() {
        log.info("创建配置类:SkuSpectficationController");
    }

    @ApiOperation("添加SKU数据")
    @PostMapping("/and")
    public String and(SkuSpecificationAndNewDTO skuSpecificationAndNewDTO){
        log.debug("请求参数：{}",skuSpecificationAndNewDTO);
        service.andNew(skuSpecificationAndNewDTO);
        return "删除完成!";
    }

    @ApiOperation("根据id删除SKU数据")
    @PostMapping("/{id:[0-9]+}}/delete")
    public String delete(@PathVariable Long id){
        log.debug("请求参数：{}",id);
        service.delete(id);
        return "添加完成!";
    }
}
